/*
* @Author: Jone XIn
* @Date: 2022-02-05 21:41:46
 * @LastEditTime: 2022-02-07 22:13:04
* @Description: 用户操作_test
*/

import User from '../../model/user/user.model';
import { successNews, catchErrNews, paramsErrNews } from '../../utils/resMessage';

export default class HandUser {

    // get user info
    public static async getUser(req, res) {

        const { name } = req.query;
        if (!name) return res.json(paramsErrNews());

        try {
            const userInfos = await User.findOne(name);
            return res.json(successNews(userInfos));
        } catch (_) {
            res.json(catchErrNews(_));
        }
    }

}